package com.cs342.uwosh.cloudycontacts;

import com.cs342.uwosh.cloudycontacts.tasks.network.AttemptRegistrationForCloudSpaceTask;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Register extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_register);
		 /*Button reg = (Button)findViewById(R.id.register_button);
	        reg.setOnClickListener(new OnClickListener()
			{
				@Override
				public void onClick(View arg0) {
					
					
					Intent intent = new Intent(Register.this,LoginActivity.class);
	                startActivity(intent);
				}
			});*/
	        
	        findViewById(R.id.submit_register).setOnClickListener(new OnClickListener()
	        {

				@Override
				public void onClick(View arg0) {
					EditText email = (EditText) findViewById(R.id.email_EditText);
					EditText passw = (EditText) findViewById(R.id.password_EditText);
					
					new AttemptRegistrationForCloudSpaceTask().execute(
							email.getText().toString(),
							passw.getText().toString()
							);
					finishHim();
									}
	        	
	        });
	        
	        findViewById(R.id.cancel_register).setOnClickListener(new OnClickListener()
	        {

				@Override
				public void onClick(View v)
				{
					finishHim();
				}
	        	
	        });
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_register, menu);
		return true;
	}
	
	private void finishHim()
	{
		this.finish();
	}

}
